package com.jeesite.modules.config.web;

import com.jeesite.common.excel.ExcelView;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.BeanNameViewResolver;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * Created by Medivh on 2018/11/30.
 * 愿我出走半生,归来仍是少年
 */
@Configuration
public class ViewConfig {
    @Bean(name="beanNameViewResolver")
    @ConditionalOnBean(View.class)
    @ConditionalOnMissingBean
    public BeanNameViewResolver beanNameViewResolver(){
        BeanNameViewResolver resolver = new BeanNameViewResolver();
        resolver.setOrder(10);
        return resolver;
    }

    @Bean(name="excel")
    public ExcelView beanExcelView(){
        ExcelView excel = new ExcelView();
        return excel;
    }


}
